import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

import org.korifey.ffalg.NumberTheory;
import org.korifey.ffalg.Probabilities;


public class Problem17 {
	
	public static void main(String[] args) {
		System.out.println(solve());
	}

	final static int n = 1000;
	
	final static String AND = "and";
	final static String HUNDRED = "hundred";
	final static String THOUSAND = "thousand";
	
	final static String[] SPECIAL = {
		"",
		"one",
		"two",
		"three",
		"four",
		"five",
		"six",
		"seven",
		"eight",
		"nine",
		"ten",
		"eleven",
		"twelve",
		"thirteen",
		"fourteen",
		"fifteen",
		"sixteen",
		"seventeen",
		"eighteen",
		"nineteen"};
	
	final static String[] TENS = {
		"",
		"ten",
		"twenty",
		"thirty",
		"forty",
		"fifty",
		"sixty",
		"seventy",
		"eighty",
		"ninety"
	};
	
	
	public static long solve(int x) {
		int res = 0;
		
		if (x >= 1000) {
			res += solve(x/1000) + THOUSAND.length();
			x %= 1000;
		}
		
		int hun = x/100;
		int ten = x % 100;
		
		if (hun > 0) {
			res += HUNDRED.length() +  SPECIAL[hun].length();
			if (ten > 0) res += AND.length();
		}
		
		if (ten < SPECIAL.length) {
			res += SPECIAL[ten].length();
		} else {
			res += TENS[ten/10].length() + SPECIAL[ten%10].length();
		}
		
		return res;
	}
	
	public static long solve() {			
		long res = 0;
		System.out.println(solve(1000));
		for (int i=1; i<=n; i++) {
			res += solve(i);
		}
		return res;
	}
	
}
